import { defineComponent, h } from "vue";

export const RouterLinkImpl = defineComponent({
  name: "RouterLink",
  compatConfig: { MODE: 3 },
  // 组件上属性
  props: {
    to: {
      type: [String, Object],
      required: true,
    },
    replace: Boolean,
    activeClass: String,
    exactActiveClass: String,
    custom: Boolean,
    ariaCurrentValue: {
      type: String,
      default: "page",
    },
  },
  setup(props, { slots }) {
    return () => {
      const children = slots.default;
      return props.custom ? children : h("a", {}, children);
    };
  },
});

export const RouterLink = RouterLinkImpl;
